﻿using Grand.Domain.Directory;
using Grand.Infrastructure.Mapper;
using Grand.Web.Admin.Models.Directory;

namespace Grand.Web.Admin.Extensions.Mapping;

public static class CountryMappingExtensions
{
    public static CountryModel ToModel(this Country entity)
    {
        return entity.MapTo<Country, CountryModel>();
    }

    public static Country ToEntity(this CountryModel model)
    {
        return model.MapTo<CountryModel, Country>();
    }

    public static Country ToEntity(this CountryModel model, Country destination)
    {
        return model.MapTo(destination);
    }

    public static StateProvinceModel ToModel(this StateProvince entity)
    {
        return entity.MapTo<StateProvince, StateProvinceModel>();
    }

    public static StateProvince ToEntity(this StateProvinceModel model)
    {
        return model.MapTo<StateProvinceModel, StateProvince>();
    }

    public static StateProvince ToEntity(this StateProvinceModel model, StateProvince destination)
    {
        return model.MapTo(destination);
    }
}